"use client"
import React from 'react'
import { Tabbar } from 'react-vant'
import { FriendsO, HomeO, Search, SettingO } from '@react-vant/icons'
import {usePathname, useRouter} from 'next/navigation'
export default () => {
    let router=useRouter()
    let pathname=usePathname()
    let tabbars=[
        {title:"首页",icon:<HomeO />,name:"/fzz/home"},
        {title:"分类",icon:<Search />,name:"/fzz/type"},
        {title:"购物车",icon:<FriendsO />,name:"/fzz/shop"},
        {title:"我的",icon:<SettingO />,name:"/fzz/my"},
    ]
    if(pathname==`/fzz/detail/`){
      return null
    }else{
      return (
        <div className='demo-tabbar'>
          <Tabbar value={pathname} onChange={(i)=>{
            router.push(i as string)
          }}>
            {
                tabbars.map(item=>{
                    return  <Tabbar.Item icon={item.icon} name={item.name}>{item.title}</Tabbar.Item>
                })
            }
          </Tabbar>
        </div>
      )
    }
    
    }
  
